<style scoped lang="stylus">
.menu
  height 100%
.el-menu-vertical-demo
  height 100%
.el-header {
  background-color: #b3c0d1;
  color: #333;
  line-height: 60px;
}
.el-aside {
  color: #333;
}
.user-head{
  width: 80px;
  height: 80px;
  border-radius: 100%;
  overflow: hidden;
  margin: 20px auto; 
  margin-bottom: 10px;
  align-self: center;
}
.user-head img{
  width: 100%;
  height: 100%;
}
</style>
<template>

<el-container style="height: 100%; border: 1px solid #eee">
  <el-aside style="background-color: #FFFFFF;width:250px">
    <el-menu
      default-active="2"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
    :default-openeds="['1', '3']">
    <div class="userInfo">
        <div class="user-head"><img :src="userHead" alt=""></div>
        <div class="user-name">{{userName}}</div>
        <div class="user-role">{{userRole}}</div>
    </div>
      <el-submenu index="1">
        <template slot="title"><i class="el-icon-message"></i>导航一</template>
        <el-menu-item-group>
          <el-menu-item index="1-1" @click="navgation()">选项1</el-menu-item>
          <el-menu-item index="1-2">选项2</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="2">
        <template slot="title"><i class="el-icon-menu"></i>导航二</template>
        <el-menu-item-group>
          <el-menu-item index="2-1">选项1</el-menu-item>
          <el-menu-item index="2-2">选项2</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="3">
        <template slot="title"><i class="el-icon-setting"></i>导航三</template>
        <el-menu-item-group>
          <el-menu-item index="3-1">选项1</el-menu-item>
          <el-menu-item index="3-2">选项2</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
  </el-aside>

  <el-container>
    <el-header style="text-align: right; font-size: 12px">
      <el-dropdown>
        <i class="el-icon-setting" style="margin-right: 15px"></i>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>查看</el-dropdown-item>
          <el-dropdown-item>新增</el-dropdown-item>
          <el-dropdown-item>删除</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
      <span>王小虎</span>
    </el-header>
    
    <el-main>
      <router-view></router-view>
      <el-table :data="tableData">
        <el-table-column prop="date" label="日期" width="250" align="center">
        </el-table-column>
        <el-table-column prop="name" label="姓名" width="250" align="center">
        </el-table-column>
        <el-table-column prop="address" label="地址" width="350" align="center">
        </el-table-column>
      </el-table>
    </el-main>
  </el-container>
</el-container>
</template>
<script>
export default {
  data() {
    const item = {
      date: "2016-05-02",
      name: "王小虎",
      address: "上海市普陀区金沙江路 1518 弄"
    };
    return {
        userHead:'../src/assets/img/header.jpg',
        userName:'Guwen',
        userRole:'管理员',
        tableData: Array(10).fill(item),
    };
  },
  methods:{
    navgation:function(){
      this.$router.push('/item');
    }
  }
};
</script>


